import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";

@Entity("card_recharge_order", { schema: "charge" })
export class CardRechargeOrder {
  @PrimaryGeneratedColumn({ type: "int", name: "id", unsigned: true })
  id: number;

  @Column("int", { name: "user_id", unsigned: true, default: () => "'0'" })
  userId: number;

  @Column("int", { name: "card_id", unsigned: true, default: () => "'0'" })
  cardId: number;

  @Column("tinyint", {
    name: "pay_channel",
    comment: "支付渠道,1:微信，2：支付宝",
    default: () => "'0'",
  })
  payChannel: number;

  @Column("varchar", { name: "order_no", comment: "订单号", length: 25 })
  orderNo: string;

  @Column("varchar", { name: "trade_no", comment: "交易号", length: 64 })
  tradeNo: string;

  @Column("decimal", {
    name: "amount",
    comment: "支付金额",
    precision: 6,
    scale: 2,
    default: () => "'0.00'",
  })
  amount: string;

  @Column("decimal", {
    name: "reward_amount",
    comment: "奖励的",
    precision: 6,
    scale: 2,
    default: () => "'0.00'",
  })
  rewardAmount: string;

  @Column("tinyint", {
    name: "status",
    comment: "0:待支付，1:已支付",
    default: () => "'0'",
  })
  status: number;

  @Column("int", {
    name: "create_time",
    comment: "创建时间",
    unsigned: true,
    default: () => "'0'",
  })
  createTime: number;

  @Column("int", {
    name: "pay_time",
    comment: "支付完成时间",
    unsigned: true,
    default: () => "'0'",
  })
  payTime: number;
}
